Events
Description
These are the event hooks for the AudioPlayer and AudioRecordAndPlayer controls.
Discussion
Custom event handlers can be added to the AudioPlayer and AudioRecorderAndPlayer controls. All events are available for both controls unless otherwise noted.
When writing your event handler, use the {dialog.object}.getControl() method to get a pointer to the audio player's JavaScript object:
var audioObj = {dialog.object}.getControl("AUDIOPLAYER1");onAbortOverwriteRecording
Fires if the user aborts a new recording that would have overwritten an existing audio recording.
This event does not have any arguments.This event is available for only the AudioRecorderAndPlayer control.
onBeforeLoad
Fires before the control is loaded. This event does not have any arguments.
onBeforeOverwriteRecording
The onBeforeOverwriteRecording event fires when there is an existing recording and the user clicks the record button. If there is an existing recording, the recording will get overwritten. This event will allow you to prompt the user if they really want to overwrite the existing recording. If the event returns false, the new recording is aborted.
This event does not have any arguments. This event is available for only the AudioRecorderAndPlayer control.
onChange
This event can be used to create a custom progress display while an audio is playing back.
The following arguments are passed to the onChange event:
Arguments
- objObject
An object that contains information about the control and the state it is in. obj has the following properties:
- idstring
The control's id.
- tEleobject
A pointer to the element where the amount of time the audio has been playing is displayed.
- tbEleobject
A pointer to the element that displays progress.
- stateobject
An object that contains state information about the audio player. state has the following properties:
- srcstring
The name of the audio file that has been loaded.
- streamboolean
Indicates if the player is in streaming mode (true) or not (false).
- playingboolean
Indicates if the player is currently playing audio (true) or not (false).
- currentnumber
The length of time the audio has been playing.
- durationnumber
The total audio length.
- eobject
An object that contains the following properties:
- typestring
Defines the type of onChange event. Can be one of the following:
- buffer
Audio is buffering.
- durationchange
Triggered after an audio file has loaded. The element that displays the duration is '{dialog.ComponentName}.'+obj.id+'.PLAYDURATION'.
- timeupdate
Triggered after an audio file has been loaded and the duration of the audio file is known. obj.state.duration and obj.state.current will contain additional information about the current state of total length of the audio file and the current point in the audio playback.
onDone
Fires when the playback is complete. This event does not have any arguments.
onError
The onError event fires when an audio file does not load. This event does not have any arguments.
onLoaded
Fires when the audio file is loaded. This event does not have any arguments.
onPause
Fires when the playback is paused. This event does not have any arguments.
onPauseRecording
Fires when recording is paused. This event does not have any arguments. This event is available for only the AudioRecorderAndPlayer control.
onPlay
Fires when audio playback begins. This event does not have any arguments.
onResumeRecording
Fires when recording resumes. This event does not have any arguments. This event is available for only the AudioRecorderAndPlayer control.
onSaveRecording
Fires when the recording is saved. This event does not have any arguments. This event is available for only the AudioRecorderAndPlayer control.
onStartRecording
Fires when recording starts. This event does not have any arguments. This event is available for only the AudioRecorderAndPlayer control.
See Also